<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simReadProximitySensor</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simReadProximitySensor" id="simReadProximitySensor"></a>simReadProximitySensor / sim.readProximitySensor</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Reads the state of a proximity sensor. This function doesn't perform detection, it merely reads the result from a previous call to <a href="simHandleProximitySensor.htm">sim.handleProximitySensor</a> (sim.handleProximitySensor is called in the default main script). See also <a href="simCheckProximitySensor.htm">sim.checkProximitySensor</a>, <a href="simCheckProximitySensorEx.htm">sim.checkProximitySensorEx</a> and <a href="simResetProximitySensor.htm">sim.resetProximitySensor</a>.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* detectedSurfaceNormalVector)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>sensorHandle</strong>: handle of a proximity sensor object</div>
<div><strong>detectedPoint</strong>: coordinates of the closest detected point (x, y and z: detectedPoint[0]-detectedPoint[2]) relative to the sensor reference frame, and distance to the detected point (1 value: detectedPoint[3]). Can be nullptr<br>
</div>
<div><strong>detectedObjectHandle</strong>: handle of the object that was detected. Can be nullptr<br>
</div>
<div><strong>detectedSurfaceNormalVector</strong>: normal vector (normalized) of the detected surface. Relative to the sensor reference frame. Can be nullptr<br>
</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>detection state (0 or 1), or -1 in case of an error, or if <a href="simHandleProximitySensor.htm">simHandleProximitySensor</a> was never called, or if <a href="simResetProximitySensor.htm">simResetProximitySensor</a> was previously called.<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>number result,number distance,table_3 detectedPoint,number detectedObjectHandle,table_3 detectedSurfaceNormalVector=sim.readProximitySensor(number sensorHandle)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>result</strong>: detection state (0 or 1), or -1 if <a href="simHandleProximitySensor.htm">sim.handleProximitySensor</a> was never called, or if <a href="simResetProximitySensor.htm">sim.resetProximitySensor</a> was previously called.<br>
</div>
<div><strong>distance</strong>: distance to the detected point<br>
</div>
<div><strong>detectedPoint</strong>: table of 3 numbers indicating the relative coordinates of the detected point<br>
</div>
<div><strong>detectedObjectHandle</strong>: handle of the object that was detected<br>
</div>
<div><strong>detectedSurfaceNormalVector</strong>: normal vector (normalized) of the detected surface. Relative to the sensor reference frame.<br>
</div>
</td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxReadProximitySensor">simxReadProximitySensor</a></div>
<div>Legacy remote API: <a href="../remoteApiFunctions.htm#simxReadProximitySensor">simxReadProximitySensor</a></div>
</td> 
</tr> 

</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
